package com.cjh.feign;

import com.cjh.pojo.Order;
import com.github.pagehelper.PageInfo;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.*;

@Component
@FeignClient(value = "ORDER")
public interface OrderFeign {

    @PostMapping("/order/insertOrder")
    boolean insertOrder(@RequestBody Order order);

    @GetMapping("/order/selectOrdersByUserId/{userId}")
    PageInfo<Order> selectOrdersByUserId(@PathVariable("userId") Integer userId,
                                        @RequestParam("page") Integer page,
                                        @RequestParam("limit") Integer limit);

    @GetMapping("/order/selectUntreatedOrders")
    PageInfo<Order> selectUntreatedOrders(@RequestParam("page") Integer page, @RequestParam("limit") Integer limit);

    @PutMapping("/order/updateOrderState/{adminId}")
    boolean updateOrderState(@PathVariable("adminId") Integer adminId,@RequestParam("id") Integer id);

    @DeleteMapping("/order/deleteOrder")
    boolean deleteOrder(@RequestParam("id") Integer id);

    @GetMapping("/order/getOrderNumber/{userId}")
    Integer getOrderNumber(@PathVariable Integer userId);
}

